<template>
	<view style="background-color: white;">
		<view class="labinfo">
			<view style="flex: 3;text-align: center;">设备编号:</view>
			<view style="flex: 7;">{{info.equipmentNo}}</view>
		</view>
		<view class="labinfo">
			<view style="flex: 3;text-align: center;">设备名称:</view>
			<view style="flex: 7;">{{eqname}}</view>
		</view>
		<view class="labinfo">
			<view style="flex: 3;text-align: center;">设备品牌:</view>
			<view style="flex: 7;">{{info.equipmentBrand}}</view>
		</view>
		<view class="labinfo">
			<view style="flex: 3;text-align: center;">产权单位:</view>
			<view style="flex: 7;">{{info.propertyUnit}}</view>

		</view>
		<view class="labinfo">
			<view style="flex: 3;text-align: center;">进场时间:</view>
			<view style="flex: 7;">{{info.intoTime}}</view>
		</view>
		<view class="labinfo" style="border-bottom: 0rpx;">
			<view style="flex: 3;text-align: center;">设备位置:</view>
			<view style="flex: 7;">{{info.equipmentAddress}}</view>
		</view>

		<!-- <view>检查详情</view> -->
		<view style="padding-left: 60rpx;">
			<view class="checkInfo" v-for="item in chenkInfo">
				<view class="chcekinfo-1">
					{{item.checkTime}}
					<!-- 圆点图标 -->
					<view class="chcekinfo-1-icon"></view>   
				</view>
				<view class="chcekinfo-2">
				     <view class="chcekinfo-2-info">
						 <view class="chcekinfo-2-info-title">
						     <view style="flex: 3;line-height: 72rpx;">检查人</view>
						     <view style="flex: 7;line-height: 72rpx;">{{item.checkPreson}}</view>
						 </view>
						 <view class="chcekinfo-2-info-title">
							 <view style="flex: 3;line-height: 72rpx;">检查项目</view>
							 <view style="flex: 7;line-height: 72rpx;">{{item.checkItem}}</view>
							 
						 </view>
						 <view class="chcekinfo-2-info-title">
							 <view style="flex: 3;line-height: 72rpx;">检查情况</view>
							 <view style="flex: 7;line-height: 72rpx;">{{item.checkSituation}}</view>
						 </view>
						 <view class="chcekinfo-2-info-title">
							 <view style="flex: 3;line-height: 72rpx;">整改措施</view>
							 <view style="flex: 7;line-height: 72rpx;">{{item.measures}}</view>
						 </view>
						 <view class="chcekinfo-2-info-title" style="border-bottom: 0rpx;">
							 <view style="flex: 3;line-height: 72rpx;">设备状态</view>
							 <view style="flex: 7;line-height: 72rpx;">{{item.equipmentState}}</view>
						 </view>
						 
					 </view>
				
				</view>
			</view>



		</view>

	</view>
</template>

<script>
	let _this;
	export default {
		data() {
			return {
				option:{},
				eqname: "",
				info: {},
				chenkInfo:[],
				listDictionaries:[]
			}
		},
		onLoad(option) {
			_this = this;
			_this.option=option;
			_this.getInfo(option.id);			
			_this.eqname = option.eqname;
            _this.getDictionaries();

		},
		//监听导航栏 点击事件
		onNavigationBarButtonTap(e) {
			
	      uni.navigateTo({
	      	url: '/pages/deviceCheck/addDeviceCheck?eqid='+_this.option.id
	      });
	
		},
		methods: {
			getInfo(id) {
				const value = uni.getStorageSync("JSESSIONID");
				const val = uni.getStorageSync("pathHost");
				uni.request({
					url: val + '/ggcapp/equipmentmanage/unitparameter/unitParameter/getInfo' + ";JSESSIONID=" + value +
						"?__ajax=true&mobileLogin=true&id=" + id,
					success(data) {
						//console.log(data)
						_this.info = data.data;
					}
				});

			},
			//获取字典信息
			getDictionaries(){
				const value = uni.getStorageSync("JSESSIONID");
				const val = uni.getStorageSync("pathHost");
				uni.request({
					url: val+'/ggcapp/sys/dict/getDictValue'+";JSESSIONID="+value+"?__ajax=true&mobileLogin=true&pageSize=999&dictTypeId=99966b6a40464ec390531d2ea193778d" ,
					success(data) {
							//console.log(data.data.rows.length)
							for (var i = 0; i < data.data.rows.length; i++) {
							    _this.listDictionaries.push({
								   id: data.data.rows[i].id,
								   label:data.data.rows[i].label, //值
								   value:data.data.rows[i].value   //缩写
							   })
							}
						_this.getCheckInfo(_this.option.id);	
					}
				});
				
			},
			getCheckInfo(id){
			
				const value = uni.getStorageSync("JSESSIONID");
				const val = uni.getStorageSync("pathHost");
				uni.request({
					url: val + '/ggcapp/equipmentmanage/equipmentcheck/ggEquipmentCheck/data' + ";JSESSIONID=" + value +
						"?__ajax=true&mobileLogin=true&equipmentId=" + id,
					success(data) {
						//console.log(data)
						
						_this.chenkInfo=[];
						   let nameou="";
						for (var i = 0; i < data.data.rows.length; i++) {
							for (var j = 0; j < _this.listDictionaries.length; j++) {
								if(_this.listDictionaries[j].value==data.data.rows[i].equipmentState){
									 nameou=_this.listDictionaries[j].label
								}
							}
							_this.chenkInfo.push({
								id: data.data.rows[i].id,
								checkItem:data.data.rows[i].checkItem,
								checkPreson:data.data.rows[i].checkPreson,
								checkTime: data.data.rows[i].checkTime,
								equipmentState:nameou,
								measures:data.data.rows[i].measures,
								checkSituation:data.data.rows[i].checkSituation
							})
						   	
						}
						
						
						
					}
				});
				
				
				
			}

		}
	}
</script>

<style>
	page{
		background-color: white;
	}
	.labinfo {
		//padding: 0rpx 50rpx 0rpx 50rpx;
		display: flex;
		flex: 10;
		height: 80rpx;
		line-height: 80rpx;
		border-bottom: 1px solid #BEBEBE;

	}

	.checkInfo {

		display: flex;
		flex-direction: column;
		flex: 20;
		border-left: 1px solid #007AFF;
		height: 500rpx;

	}

	.chcekinfo-1 {
		flex: 3;
		line-height: 108rpx;
		border: 0px solid #0081FF;
		position: relative;
		padding-left: 20rpx;
	}

	.chcekinfo-1-icon {
		background-color: #007AFF;
		height: 25rpx;
		width: 25rpx;
		border-radius: 50%;
		position: absolute;
		top: 38%;
		left: -2%;
	}

	.chcekinfo-2 {
		flex: 17;
		padding-left: 20rpx;
	}
	.chcekinfo-2-info{
		height: 340rpx;
		width: 80%;
		border: 1rpx solid #929292;
		display: flex;
		flex-direction: column;
		font-size: 26rpx;
		border-radius: 8rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
	}
	.chcekinfo-2-info-title{
		flex: 10;
		display: flex;
		border-bottom: 1px solid #C8C7CC;
	}
	
</style>
